/*

  The contents of this file are subject to the Mozilla Public License Version
  1.1 (the "License"); you may not use this file except in compliance with
  the License. You may obtain a copy of the License at 
  
           http://www.mozilla.org/MPL/ 
  
  Software distributed under the License is distributed on an "AS IS" basis,
  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  for the specific language governing rights and limitations under the License. 
  
  The Original Code is AST'r Framework.
  
  The Initial Developer of the Original Code is
  ALCARAZ Marc (aka eKameleon) <vegas@ekameleon.net>.
  Portions created by the Initial Developer are Copyright (C) 2004-2007
  the Initial Developer. All Rights Reserved.
  
  Contributor(s) :
  
 */





import ewhiteboard.vo.ShapeVO;

import lunas.display.abstract.AbstractButtonDisplay;

/**
 * This display defines the basic implementation to creates shape display in the a whiteboard display.
 * @author eKameleon
 */
class ewhiteboard.display.whiteboard.shapes.WhiteBoardShapeDisplay extends AbstractButtonDisplay 
{
	
	/**
	 * Creates a new WhiteboardShapeDisplay instance.
	 * @param sName:String the name of the display.
	 * @param target:MovieClip the DisplayObject instance control this target.
	 */
	public function WhiteBoardShapeDisplay( sName:String , target:MovieClip )
	{
		
		super( sName , target ) ;
		box = MovieClip(view).createEmptyMovieClip( DEFAULT_BOX_NAME , DEFAULT_BOX_DEPTH ) ;
		
	}
	
	/**
	 * The default container movieclip name value.
	 */
	public static var DEFAULT_BOX_NAME:String = "box" ;
	
	/**
	 * The default container movieclip depth value.
	 */
	public static var DEFAULT_BOX_DEPTH:Number = 9999 ;
	
	/**
	 * The freehand shape box reference.
	 */
	public var box:MovieClip ;
	
	/**
	 * (Read-write) Defines the shape value object of this display.
	 */
	public function get shape():ShapeVO
	{
		return getShape() ;
	}
	
	/**
	 * @private
	 */
	public function set shape( shape:ShapeVO ):Void
	{
		setShape( shape ) ;
	}
	
	/**
	 * Returns the shape value object of this display.
	 * @return the shape value object of this display.
	 */
	public function getShape():ShapeVO
	{
		return _shape ;
	}
	
	/**
	 * Returns the shape value object of this display.
	 * @return the shape value object of this display.
	 */
	public function setShape( shape:ShapeVO ):Void
	{
		_shape = shape ;
		update() ;
	}
	
	/**
	 * Invoqued when the label change in the component.
	 */
	public /*override*/ function viewLabelChanged():Void 
	{
		update() ;
	}

	/**
	 * Invoqued when the style of the component is changed.
	 */
	public /*override*/ function viewStyleChanged():Void 
	{
		update() ;
	}	
	
	private var _shape:ShapeVO ;	
	
}